//
// CVPSwizzle.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

public class CVPSwizzle {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVPSwizzle(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVPSwizzle obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CVPSwizzle(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setComp(SWIGTYPE_p_CVPSwizzle__EComp value) {
    nel3dJNI.CVPSwizzle_Comp_set(swigCPtr, this, SWIGTYPE_p_CVPSwizzle__EComp.getCPtr(value));
  }

  public SWIGTYPE_p_CVPSwizzle__EComp getComp() {
    long cPtr = nel3dJNI.CVPSwizzle_Comp_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_CVPSwizzle__EComp(cPtr, false);
  }

  public boolean isScalar() {
    return nel3dJNI.CVPSwizzle_isScalar(swigCPtr, this);
  }

  public boolean isIdentity() {
    return nel3dJNI.CVPSwizzle_isIdentity(swigCPtr, this);
  }

  public CVPSwizzle() {
    this(nel3dJNI.new_CVPSwizzle(), true);
  }

  public final static class EComp {
    public final static EComp X = new EComp("X", nel3dJNI.CVPSwizzle_X_get());
    public final static EComp Y = new EComp("Y", nel3dJNI.CVPSwizzle_Y_get());
    public final static EComp Z = new EComp("Z", nel3dJNI.CVPSwizzle_Z_get());
    public final static EComp W = new EComp("W", nel3dJNI.CVPSwizzle_W_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static EComp swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + EComp.class + " with value " + swigValue);
    }

    private EComp(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private EComp(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private EComp(String swigName, EComp swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static EComp[] swigValues = { X, Y, Z, W };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
